fromagenticaiframeworkimportAgent# Minimal setup β auto-configures LLM from environment variablesagent=Agent.quick("Assistant")output=agent.invoke("What is the capital of France?")
fromagenticaiframeworkimportAgent# Create a research agentresearcher=Agent.quick("ResearchBot",role="researcher",provider="openai",)output=researcher.invoke("Summarise the latest trends in AI safety")# Create a coding agentcoder=Agent.quick("CodeHelper",role="coder",provider="anthropic",)output=coder.invoke("Write a Python function to merge two sorted lists")
fromagenticaiframeworkimportAgentagent=Agent(name="research_assistant",role="Expert researcher with deep analytical skills",capabilities=["search","summarization","reasoning"],config={"llm":"gpt-4o","temperature":0.7},max_context_tokens=8192,)result=agent.execute("Analyse the current state of quantum computing")
fromagenticaiframeworkimportProcessproc=Process(name="multi_fetch",strategy="parallel",max_workers=4)forsourcein["arxiv","scholar","semantic"]:proc.add_task(fetch_papers,source)results=proc.execute()# All sources fetched concurrently
fromagenticaiframework.memoryimportMemoryManagermemory=MemoryManager()# Store a memorymemory.store(content="User prefers concise responses",metadata={"type":"preference","user_id":"alice"},)# Search memoriesresults=memory.search("user preferences",top_k=5)
fromagenticaiframeworkimportKnowledgeRetrieverretriever=KnowledgeRetriever()retriever.register_source("docs",my_search_function)# Query with automatic LRU cachingresult=retriever.retrieve("docs","How to configure agents?")
fromagenticaiframeworkimportMonitoringSystemmonitor=MonitoringSystem()# Record metricsmonitor.record_metric("latency_ms",42.5)monitor.log_event("task_completed",{"task":"summarise"})# Retrieve datametrics=monitor.get_metrics()events=monitor.get_events()gc_stats=monitor.get_gc_stats()
fromagenticaiframework.complianceimportPIIMaskermasker=PIIMasker()masked_text=masker.mask("Contact John at john@email.com or 555-1234")# Output: Contact [NAME] at [EMAIL] or [PHONE]
fromagenticaiframework.tracingimportTracingManagertracer=TracingManager(service_name="my-agent-service",)withtracer.span("agent_execution"):result=agent.execute("Process this task")