⏺ The Grep Assistant: A Self-Orchestrating AI Agentic Process
The grep-assistant is a Petri-net-driven AI-driven agentic process that shows how autonomous agents can plan, execute, and refine tasks. It supports remote command execution while remaining centrally managed by a human or supervisory agent in the loop.
Architecture


How It Works
1. Natural language input
A user or another agent drops a task token like “Find all Java classes containing ‘agent’” into the grep place.
2. AI planning (plan-grep)
An LLM-based planning transition:
- Reads the task token
- Studies example command patterns from the examples place
- Generates safe bash commands
- Creates structured command tokens (kind, executor, args, etc.)
Example command token:
{
"kind": "bash",
"executor": "remote-01",
"args": ["grep", "-R", "-n", "agent", "./"]
}
3. Automated remote execution (execute-grep)
A command-executor transition:
- Consumes command tokens from commands
- Executes them on a remote machine or container
- Emits results as tokens into the responses place
- Allows a human or manager agent to review, approve, or redirect commands
What Makes It Special
- Self-improving: The agent learns command patterns from example tokens.
- Clear separation: AI planning and shell execution are separate, auditable steps.
- Token-driven transparency: No hidden state — all context flows through places and transitions.
- Composable: You can add filtering, aggregation, notification, or post-processing transitions without changing existing ones.
- Human/agent-in-the-loop control: Planned commands can be centrally inspected, approved, and routed to different remote executors.
Real Example
Input:
“Find all Java classes that contain the word agent”
Output (sample paths):
/agentic-net-master/.../AgentToolExecutor.java /agentic-net-agent/.../AgentOrchestrationService.java /agentic-net-node/.../AgentHeartbeatHandler.java ...
This pattern — AI agents creating structured tokens for downstream executors — is a powerful foundation for building complex, observable, and self-documenting automation agentic processes.
Remote Execution: How Commands Are Actually Run
The execute-grep transition is not just a simulated executor inside the system. It is a real remote execution unit deployed on a separate node (or even on a cluster of remote nodes). This makes the grep-assistant more than an AI-driven agentic process — it becomes a distributed execution system.
When the planner generates a command token, the remote executor node:
- Pulls command tokens from the commands place
- Runs the actual shell commands on its own machine or container
- Transforms the raw output (stdout, stderr, exit codes)
- Emits structured result tokens back into the responses place
This means every result token visible in the responses place originates from a real command execution on a real remote machine. The Petri net simply orchestrates the flow, while the remote executor performs the tangible work.
Because the executor transition is isolated and remotely deployed, the system ensures:
- Safety — AI never has direct shell access, only structured instructions
- Auditability — every executed command is traceable as a token
- Scalability — multiple executors can run commands in parallel
- Flexibility — different transitions can target different remote nodes
In other words, the Petri net plans what to do, the remote executor performs how and where the action happens, and the results return as clean, observable tokens for further AI-driven processing.
AI-Generated Net Structure & Inscriptions
One of the most remarkable aspects of this agentic process is that the entire Petri net — including all places, transitions, inscriptions, metadata, and even the initial example tokens used by the agent — was generated by an AI agent itself.
In this case, the design was created by a Cloud Code Agent, which understands how to translate natural language descriptions into fully defined Petri nets. This agent produced:
- All places (grep, commands, responses, examples)
- All transitions (plan-grep, execute-grep)
- All inscriptions and wiring between places and transitions
- Structured example tokens that teach the planner how to form commands
- A consistent naming scheme for the agentic process elements
This means the grep-assistant is not just executed by AI — it is literally designed by AI.
Even more importantly, the platform already includes (or is actively developing) an internal Universal AI Design Agent. This built-in agent will allow anyone to describe an agentic process in natural language, after which the system will automatically:
- Generate a complete Petri net structure
- Create transitions for planning, execution, validation, or orchestration
- Produce example tokens for training other agents
- Insert inscriptions and parameters automatically
- Deploy the new net into the runtime without manual editing
With this capability, users can simply state what they want to automate, and the system will design, configure, and operationalize a full AI-driven agentic process — turning high-level ideas into working agentic systems.