You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -507,6 +507,60 @@ triage = AgentSpec(
507
507
```
508
508
509
509
510
+
### Autonomous Agents
511
+
512
+
**Agents** are emerging in production as LLMs mature in key capabilities—understanding complex inputs, engaging in reasoning and planning, using tools reliably, and recovering from errors.
513
+
514
+
```mermaid
515
+
flowchart LR
516
+
H([Human]) <-.-> TA[Agent] -.-> S([Stop])
517
+
518
+
subgraph TA[Agent]
519
+
A[Agent]
520
+
A --> |Action| E([Environment])
521
+
E --> |Feedback| A
522
+
end
523
+
524
+
style H fill:#ffb3ba,stroke-width:0px;
525
+
style A fill:#baffc9,stroke-width:0px;
526
+
style E fill:#ffb3ba,stroke-width:0px;
527
+
style TA fill:#fff,stroke:#000,stroke-width:1px,stroke-dasharray: 2 2
528
+
```
529
+
530
+
**When to use agents:** Agents can be used for open-ended problems where it’s difficult or impossible to predict the required number of steps, and where you can’t hardcode a fixed path. The Agent will potentially operate for many turns, and you must have some level of trust in its decision-making. Agents' autonomy makes them ideal for scaling tasks in trusted environments.
531
+
532
+
**Example** (see [examples/patterns/autonomous_agent.py](examples/patterns/autonomous_agent.py) for a runnable example):
533
+
534
+
```python
535
+
from coagent.agents import Model
536
+
from coagent.agents.react_agent import ReActAgent, RunContext
537
+
from coagent.core import AgentSpec, new
538
+
539
+
asyncdefget_current_city(ctx: RunContext) -> str:
540
+
"""Get the current city."""
541
+
ctx.report_progress(message="Getting the current city...")
0 commit comments